const Sequelize = require('sequelize')
module.exports = function(sequelize, DataTypes, { sys_post, sys_user }) {
  return sequelize.define('sys_user_post', {
    user_id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: '用户ID',
      references: {
        model: sys_user, // 'Movies' 也可以使用
        key: 'user_id'
      }

    },
    post_id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: '岗位ID',
      references: {
        model: sys_post, // 'Movies' 也可以使用
        key: 'post_id'
      }
    }
  }, {
    sequelize,
    tableName: 'sys_user_post',
    timestamps: false,
    indexes: [
      {
        name: 'PRIMARY',
        unique: true,
        using: 'BTREE',
        fields: [
          { name: 'user_id' },
          { name: 'post_id' }
        ]
      }
    ]
  })
}
